package com.letian.record.service.impl;

import java.util.List;
import com.letian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.letian.record.mapper.PhoneBookMapper;
import com.letian.record.domain.PhoneBook;
import com.letian.record.service.IPhoneBookService;

/**
 * 电话本Service业务层处理
 * 
 * @author bmz
 * @date 2023-01-15
 */
@Service
public class PhoneBookServiceImpl implements IPhoneBookService 
{
    @Autowired
    private PhoneBookMapper phoneBookMapper;

    /**
     * 查询电话本
     * 
     * @param phoneId 电话本主键
     * @return 电话本
     */
    @Override
    public PhoneBook selectPhoneBookByPhoneId(Long phoneId)
    {
        return phoneBookMapper.selectPhoneBookByPhoneId(phoneId);
    }

    /**
     * 查询电话本列表
     * 
     * @param phoneBook 电话本
     * @return 电话本
     */
    @Override
    public List<PhoneBook> selectPhoneBookList(PhoneBook phoneBook)
    {
        return phoneBookMapper.selectPhoneBookList(phoneBook);
    }

    /**
     * 新增电话本
     * 
     * @param phoneBook 电话本
     * @return 结果
     */
    @Override
    public int insertPhoneBook(PhoneBook phoneBook)
    {
        phoneBook.setCreateTime(DateUtils.getNowDate());
        return phoneBookMapper.insertPhoneBook(phoneBook);
    }

    /**
     * 修改电话本
     * 
     * @param phoneBook 电话本
     * @return 结果
     */
    @Override
    public int updatePhoneBook(PhoneBook phoneBook)
    {
        phoneBook.setUpdateTime(DateUtils.getNowDate());
        return phoneBookMapper.updatePhoneBook(phoneBook);
    }

    /**
     * 批量删除电话本
     * 
     * @param phoneIds 需要删除的电话本主键
     * @return 结果
     */
    @Override
    public int deletePhoneBookByPhoneIds(Long[] phoneIds)
    {
        return phoneBookMapper.deletePhoneBookByPhoneIds(phoneIds);
    }

    /**
     * 删除电话本信息
     * 
     * @param phoneId 电话本主键
     * @return 结果
     */
    @Override
    public int deletePhoneBookByPhoneId(Long phoneId)
    {
        return phoneBookMapper.deletePhoneBookByPhoneId(phoneId);
    }
}
